package com.zrc.module_find.activity.defrecycleview.demo1

import android.content.Context
import android.widget.TextView
import com.blankj.utilcode.util.ToastUtils
import com.zrc.module_find.R

/**
 * @Author: superman
 * @CreateTime: 6/27/21
 * @Describe:
 */
class CoinAdapter(
    context: Context,
    dataList: List<CoinInfo>,
    layoutId: Int,
) : CommonAdapter<CoinInfo>(context, dataList, layoutId) {
    override fun bindData(holder: CommonViewHolder, data: CoinInfo) {
        holder.setText(R.id.tv_start, "${holder.position}")
            .setText(R.id.tv1, data.priceLast)
            .setText(R.id.tv2, data.riseRate24)
            .setText(R.id.tv3, data.vol24)
            .setText(R.id.tv4, data.close)
            .setText(R.id.tv5, data.open)
            .setText(R.id.tv6, data.bid)
            .setText(R.id.tv7, data.ask)
            .setText(R.id.tv8, data.amountPercent)
            .setOnChildClickListener<TextView>(R.id.tv_start) {
                ToastUtils.showLong(data.name)
            }
            .setOnClickListener {
                ToastUtils.showLong( holder.position)
            }
    }
}